import request from '@/utils/request'

// 查询核销信息列表
export function listWriteOff(query) {
  return request({
    url: '/writeOff/list',
    method: 'get',
    params: query
  })
}

// 查询核销信息全部列表
export function listAllWriteOff(query) {
  return request({
    url: '/writeOff/listAll',
    method: 'get',
    params: query
  })
}

// 查询操作日志信息列表
export function recordList(query) {
  return request({
    url: '/writeOff/recordList',
    method: 'get',
    params: query
  })
}

// 查询账号信息详细
export function getWriteOff(userId) {
  return request({
    url: '/writeOff/' + userId,
    method: 'get'
  })
}

// 新增核销信息
export function addWriteOff(data) {
  return request({
    url: '/writeOff',
    method: 'post',
    data: data
  })
}

// 修改核销信息
export function updateWriteOff(data) {
  return request({
    url: '/writeOff/updateWriteOff',
    method: 'post',
    data: data
  })
}

// 核销状态修改
export function changeWriteOffStatus(userId, status) {
  const data = {
    userId,
    status
  }
  return request({
    url: '/writeOff/changeStatus',
    method: 'put',
    data: data
  })
}

// 核销开台权限
export function changeWriteOffPower(userId, power) {
  const data = {
    userId,
    power
  }
  return request({
    url: '/writeOff/changePower',
    method: 'put',
    data: data
  })
}

// 核销余额修改
export function changeWriteOffBalance(data, type) {
  return request({
    url: '/writeOff/changeBalance/' + type,
    method: 'post',
    data: data
  })
}

// 查询核销信息详细
export function getWriteOffInfo(userId) {
  return request({
    url: '/writeOff/getWriteOffInfo/' + userId,
    method: 'get'
  })
}

// 重置密码
export function resetPassword(userId) {
  return request({
    url: '/writeOff/resetPassword/' + userId,
    method: 'put'
  })
}

// 删除核销
export function delWriteOff(userId) {
  return request({
    url: '/writeOff/delete/' + userId,
    method: 'put'
  })
}
